package com.itheima.dubbo.service;

import com.itheima.dubbo.UserInterface;
import org.apache.dubbo.config.annotation.DubboService;
import org.apache.dubbo.config.annotation.Method;
import org.apache.dubbo.rpc.RpcContext;

/**
 * 幂等性操作
 */
//注册到注册中心
//@DubboService(timeout = 3000)//超时时间配置，默认一秒
//@DubboService(methods = {
//        @Method(name = "hello",timeout =9000 ),
//        @Method(name = "aa",timeout =9000 )
//})
   // @DubboService(retries = 0)

//@DubboService(version = "1.0.1")//版本不兼容的拼滑过度、
    @DubboService
public class UserServiceImpl implements UserInterface {
    @Override
    public String hello(String username) {
        String jwt= RpcContext.getContext().getAttachment("jwt");
        System.out.println(jwt);
//        try {
//            Thread.sleep(2000l);
//        } catch (InterruptedException e) {
//            e.printStackTrace();
//        }

        return "hello Dubbo username:"+username;
    }
//    public void aa(){}
//    public void xxx(){
//        String index= RpcContext.getContext().getAttachment("index");
//    }

}
